////package 串口通讯;
////
////<<<<<<< .mine
////import java.io.IOException;
////import java.io.InputStream;
////import java.io.OutputStream;
////
////import javax.comm.CommPortIdentifier;
////import javax.comm.SerialPort;
////
////public class CommTest {
////	public static void main(String[] args) {
////		process();
//////		 for (int i = 0; i < 10; i++) {
//////		 try {
//////		 CommPortIdentifier port = CommPortIdentifier.getPortIdentifier("COM"
//////		 + i);
//////		 System.out.println("打开成功" + "COM" + i);
//////		 } catch (Exception e) {
//////		 }
//////		 }
//////
//////		
//////		 CommPort open = port.open("", 5000);
//////		
//////		 System.out.println(open + "被打开!");
//////		
//////		 final InputStream is = open.getInputStream();
//////		
//////		 DataInputStream dis = new DataInputStream(is);
//////		
//////		 open.setInputBufferSize(8);
//////		
//////		 int i = 0;
//////		 while (true) {
//////		 System.out.print(dis.readByte() + " ");
//////		 if (++i % 10 == 0) {
//////		 System.out.println();
//////		 }
//////		 }
////
////	}
////
////	public static void process() {
////		InputStream in = null;
////		OutputStream out = null;
////		SerialPort serialPort = null;
////		try {
////			CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM2");
////			serialPort = (SerialPort) portId.open("Serial_Communication", 1000);// 打开串口的超时时间为1000ms
////
////			serialPort.setSerialPortParams(
////					9600, 				   // 设置串口速率为11520
////					SerialPort.DATABITS_8, // 数据位8位
////					SerialPort.STOPBITS_1, // 停止位1们，
////					SerialPort.PARITY_NONE // 奇偶校验无
////					);
////
////			in = serialPort.getInputStream(); // 得到输入流
////			out = serialPort.getOutputStream(); // 得到输出流
////
////			test(in, out);
////
////		} catch (Exception e) {
////			e.printStackTrace();
////		} finally {
////			try {
////				if (in != null)
////					in.close();
////				if (out != null)
////					out.close();
////				if (serialPort != null)
////					serialPort.close();// 关闭串口
////			} catch (Exception e) {
////			}
////		}
////
////	}
////
////
////	private static void test(final InputStream in, final OutputStream out) throws IOException {
////=======
////import java.io.IOException;
////import java.io.InputStream;
////import java.io.OutputStream;
////
////import javax.comm.CommPortIdentifier;
////import javax.comm.SerialPort;
////
////public class CommTest {
////	public static void main(String[] args) {
////		process();
//////		 for (int i = 0; i < 10; i++) {
//////		 try {
//////		 CommPortIdentifier port = CommPortIdentifier.getPortIdentifier("COM"
//////		 + i);
//////		 System.out.println("打开成功" + "COM" + i);
//////		 } catch (Exception e) {
//////		 }
//////		 }
//////
//////		
//////		 CommPort open = port.open("", 5000);
//////		
//////		 System.out.println(open + "被打开!");
//////		
//////		 final InputStream is = open.getInputStream();
//////		
//////		 DataInputStream dis = new DataInputStream(is);
//////		
//////		 open.setInputBufferSize(8);
//////		
//////		 int i = 0;
//////		 while (true) {
//////		 System.out.print(dis.readByte() + " ");
//////		 if (++i % 10 == 0) {
//////		 System.out.println();
//////		 }
//////		 }
////
////	}
////
////	// 9600,
////	// 4800,
////	// 2400,
////	// 1200,
////
////	// 115200, // 设置串口速率为11520
////	// 57600,
////	// 38400,
////	public static void process() {
////		InputStream in = null;
////		OutputStream out = null;
////		SerialPort serialPort = null;
////		try {
////<<<<<<< .mine
////=======
////			CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM2");
////			serialPort = (SerialPort) portId.open("Serial_Communication", 1000);// 打开串口的超时时间为1000ms
////>>>>>>> .r258
////
////			CommPortIdentifier portId = CommPortIdentifier
////					.getPortIdentifier("COM4");
////			serialPort = (SerialPort) portId.open("Serial_Communication", 1000);// 打开串口的超时时间为1000ms
////			serialPort.setSerialPortParams(
////<<<<<<< .mine
////					19200, 
////=======
////					9600, 				   // 设置串口速率为11520
////>>>>>>> .r258
////					SerialPort.DATABITS_8, // 数据位8位
////					SerialPort.STOPBITS_1, // 停止位1们，
////					SerialPort.PARITY_NONE // 奇偶校验无
////					);
////
////			in = serialPort.getInputStream(); // 得到输入流
////			out = serialPort.getOutputStream(); // 得到输出流
////
////			test(in, out);
////
////		} catch (Exception e) {
////			e.printStackTrace();
////		} finally {
////			try {
//////				if (in != null)
//////					in.close();
//////				if (out != null)
//////					out.close();
//////				if (serialPort != null)
//////					serialPort.close();// 关闭串口
////			} catch (Exception e) {
////			}
////		}
////
////	}
////
////<<<<<<< .mine
////=======
////
////>>>>>>> .r258
////	private static void test(final InputStream in, final OutputStream out) throws IOException {
////
////		long time1;
////		long time2;
////		long time3;
//>>>>>>> .r346
////		
//<<<<<<< .mine
////		long time1;
////		long time2;
////		long time3;
//=======
////		byte w = 1;
////<<<<<<< .mine
////		while (true) {
////
////			out.write(w);
////			System.out.println("发送: " + w);
////
////			sleep();
////			
//////			int read = in.read();
//////			System.out.println(" -- 收到: " + read);
////
////			w++;
////			if(w > 15) {
////				w = 0;
////			}
////			sleep();
////		}
////=======
////
////		new Thread(new Runnable() {
////			public void run() {
////				
////				while(true) {
////					try {
////						out.write(1);
////						sleep();
////					} catch (IOException e) {
////						// TODO Auto-generated catch block
////						e.printStackTrace();
////					}
////				}
////				
////			}
////		}).start();
////>>>>>>> .r258
////
////
////		new Thread(new Runnable() {
////			public void run() {
////				
////				byte read = 0;
////				while(true) {
////					try {
////						read = (byte) in.read();
////						sleep();
////					} catch (IOException e) {
////						// TODO Auto-generated catch block
////						e.printStackTrace();
////					}
////					System.out.println("收到: " + read);
////				}
////				
////			}
////		}).start();
//>>>>>>> .r346
////		
//<<<<<<< .mine
////		byte w = 1;
////
////		new Thread(new Runnable() {
////			public void run() {
////				
////				while(true) {
////					try {
////						out.write(1);
////					} catch (IOException e) {
////						// TODO Auto-generated catch block
////						e.printStackTrace();
////					}
////				}
////				
////			}
////		}).start();
////		
////
////		new Thread(new Runnable() {
////			public void run() {
////				
////				byte read = 0;
////				while(true) {
////					try {
////						read = (byte) in.read();
////					} catch (IOException e) {
////						// TODO Auto-generated catch block
////						e.printStackTrace();
////					}
////					System.out.println("收到: " + read);
////				}
////				
////			}
////		}).start();
////		
////	}
////
////	private static void sleep() {
////		try {
////			Thread.sleep(10);
////		} catch (InterruptedException e) {
////			e.printStackTrace();
////		}
////	}
////}
////		 int i = 0;
////		 while (true) {
////		 System.out.print(dis.readByte() + " ");
////		 if (++i % 10 == 0) {
////		 System.out.println();
////		 }
////		 }
//
////	}
////
////	public static void process() {
////		InputStream in = null;
////		OutputStream out = null;
////		SerialPort serialPort = null;
////		try {
////			CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM2");
////			serialPort = (SerialPort) portId.open("Serial_Communication", 1000);// 打开串口的超时时间为1000ms
////
////			serialPort.setSerialPortParams(
////					9600, 				   // 设置串口速率为11520
////					SerialPort.DATABITS_8, // 数据位8位
////					SerialPort.STOPBITS_1, // 停止位1们，
////					SerialPort.PARITY_NONE // 奇偶校验无
////					);
////
////			in = serialPort.getInputStream(); // 得到输入流
////			out = serialPort.getOutputStream(); // 得到输出流
////
////			test(in, out);
////
////		} catch (Exception e) {
////			e.printStackTrace();
////		} finally {
////			try {
//////				if (in != null)
//////					in.close();
//////				if (out != null)
//////					out.close();
//////				if (serialPort != null)
//////					serialPort.close();// 关闭串口
////			} catch (Exception e) {
////			}
////		}
////
////	}
////
////
////	private static void test(final InputStream in, final OutputStream out) throws IOException {
////		
////		long time1;
////		long time2;
////		long time3;
////		
////		byte w = 1;
////
////		new Thread(new Runnable() {
////			public void run() {
////				
////				while(true) {
////					try {
////						out.write(1);
////						sleep();
////					} catch (IOException e) {
////						// TODO Auto-generated catch block
////						e.printStackTrace();
////					}
////				}
////				
////			}
////		}).start();
////		
////
////		new Thread(new Runnable() {
////			public void run() {
////				
////				byte read = 0;
////				while(true) {
////					try {
////						read = (byte) in.read();
////						sleep();
////					} catch (IOException e) {
////						// TODO Auto-generated catch block
////						e.printStackTrace();
////					}
////					System.out.println("收到: " + read);
////				}
////				
////			}
////		}).start();
////		
////	}
////
////	private static void sleep() {
////		try {
////			Thread.sleep(1000);
////		} catch (InterruptedException e) {
////			e.printStackTrace();
////		}
////	}
////}
//=======
////	}
////
////	private static void sleep() {
////		try {
////			Thread.sleep(100);
////		} catch (InterruptedException e) {
////			e.printStackTrace();
////		}
////	}
////}
//>>>>>>> .r346
